﻿using System;

namespace Be.Timvw.Framework.Domain.Ranges
{
    /// Represents a range of elements.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IRange<T> : IComparable<IRange<T>>
    {
        /// <summary>
        /// Gets the Begin.
        /// </summary>
        T Begin { get; }

        /// <summary>
        /// Gets the End.
        /// </summary>
        T End { get; }

        /// <summary>
        /// Tests if element is included.
        /// </summary>
        /// <param name="element"></param>
        /// <returns>true if element is included.</returns>
        bool Includes(T element);

        /// <summary>
        /// Tests if the range is included.
        /// </summary>
        /// <param name="range"></param>
        /// <returns>true if range is included.</returns>
        bool Includes(IRange<T> range);

        /// <summary>
        /// Tests is this range overlaps the given range.
        /// </summary>
        /// <param name="range"></param>
        /// <returns>true if this range overlaps the given range.</returns>
        bool Overlaps(IRange<T> range);
    }
}